<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Hoodoo::Logger::LogEntriesDotComWriter</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        <h1>
            <span class="type">Class</span>
            Hoodoo::Logger::LogEntriesDotComWriter
                <span class="parent">&lt;
                    <a href="FastWriter.html">Hoodoo::Logger::FastWriter</a>
                </span>
        </h1>
        <ul class="files">
            <li><a href="../../../files/lib/hoodoo/logger/writers/log_entries_dot_com_writer_rb.html">lib/hoodoo/logger/writers/log_entries_dot_com_writer.rb</a></li>
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
    <div class="description">
      
<p>Writes structured messages to logentries.com via the “le” gem, which uses
its own asynchronous worker thread for network data. Thus, a <a
href="FastWriter.html">Hoodoo::Logger::FastWriter</a> subclass. See also <a
href="../Logger.html">Hoodoo::Logger</a>.</p>

    </div>








    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
        <dt>N</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-c-new">new</a>
              </li>
          </ul>
        </dd>
        <dt>R</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-report">report</a>
              </li>
          </ul>
        </dd>
    </dl>










    <!-- Methods -->
      <div class="sectiontitle">Class Public methods</div>
        <div class="method">
          <div class="title method-title" id="method-c-new">
              <b>new</b>( token )
            <a href="../../../classes/Hoodoo/Logger/LogEntriesDotComWriter.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>Create a log writer instance.</p>
<dl class="rdoc-list note-list"><dt>token
<dd>
<p>Your logentries.com API token.</p>
</dd></dl>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/logger/writers/log_entries_dot_com_writer.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>( <span class="ruby-identifier">token</span> )
  <span class="ruby-identifier">@@logger</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Le</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">token</span>, <span class="ruby-value">:ssl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span> )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
      <div class="sectiontitle">Instance Public methods</div>
        <div class="method">
          <div class="title method-title" id="method-i-report">
              <b>report</b>( log_level, component, code, data )
            <a href="../../../classes/Hoodoo/Logger/LogEntriesDotComWriter.html#method-i-report" name="method-i-report" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="WriterMixin.html#method-i-report">Hoodoo::Logger::WriterMixin#report</a>.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-report_source')" id="l_method-i-report_source">show</a>
              </p>
              <div id="method-i-report_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/logger/writers/log_entries_dot_com_writer.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">report</span>( <span class="ruby-identifier">log_level</span>, <span class="ruby-identifier">component</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">data</span> )
  <span class="ruby-identifier">method</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">log_level</span>
    <span class="ruby-keyword">when</span> <span class="ruby-value">:debug</span>, <span class="ruby-value">:info</span>, <span class="ruby-value">:warn</span>, <span class="ruby-value">:error</span>
      <span class="ruby-identifier">log_level</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-value">:unknown</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">message</span> = {
    <span class="ruby-value">:level</span>     =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">log_level</span>,
    <span class="ruby-value">:component</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">component</span>,
    <span class="ruby-value">:code</span>      =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">code</span>,
    <span class="ruby-value">:data</span>      =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">data</span>
  }

  <span class="ruby-comment"># This method is only called if the log level set elsewhere</span>
  <span class="ruby-comment"># is already appropriate; always make sure that the &#39;LE&#39; class</span>
  <span class="ruby-comment"># logging level is as low as possible so it doesn&#39;t filter any</span>
  <span class="ruby-comment"># additional messages accidentally.</span>

  <span class="ruby-identifier">@@logger</span>.<span class="ruby-identifier">level</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
  <span class="ruby-identifier">@@logger</span>.<span class="ruby-identifier">send</span>( <span class="ruby-identifier">method</span>, <span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>.<span class="ruby-identifier">generate</span>( <span class="ruby-identifier">message</span> ) )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
</div>

    </div>
  </body>
</html>
